#!/bin/bash
# 本脚本涉及：时间的笔记
# 获取时间戳
t1=`date +%s`
# echo $t1
is_install_whois()
{
    which whois > /dev/null 2> /dev/null
    if [ $? -ne 0 ]
    then
        yum install -y jwhois
    fi
}
notify()
{
    e_d=`cat ./89.txt | grep -E "Expire Date|Expiration Date|Expiration Time" | awk -F'Date: ' '{print $2}' | sed -r 's/(T|Z)/ /g'`
    t2=`date -d "$e_d" +%s`
    n=`echo "3600*24*7"|bc`
    t3=$[$t2-$n]
    if [ $t1 -ge $t2 ] && [ $t1 -lt $t2 ]
    then
        echo "邮件通知"
    else
        echo "没有过期"
    fi
}


is_install_whois
notify
# notify apelearn.com

